import 'package:flutter/material.dart';

import 'GradientButton.dart';

class GradientButtonRoute extends StatefulWidget {
  const GradientButtonRoute({super.key});

  @override
  _GradientButtonRouteState createState() => _GradientButtonRouteState();
}

class _GradientButtonRouteState extends State<GradientButtonRoute> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text("组件组合")),
      body: Container(
        child: Column(
          children: <Widget>[
            GradientButton(
              colors: [Colors.orange, Colors.red],
              height: 50.0,
              width: 200.0,
              // 添加宽度
              borderRadius: BorderRadius.circular(25.0),
              onPressed: onTap,
              // 添加圆角半径
              child: Text("Submit"),
            ),
            GradientButton(
              height: 50.0,
              width: 200.0,
              // 添加宽度
              borderRadius: BorderRadius.circular(25.0),
              // 添加圆角半径
              colors: [Colors.lightGreen, Colors.teal[700] ?? Colors.teal],
              onPressed: onTap,
              child: Text("Submit"),
            ),
            GradientButton(
              height: 50.0,
              width: 200.0,
              // 添加宽度
              borderRadius: BorderRadius.circular(25.0),
              // 添加圆角半径
              colors: [Colors.lightBlue[300] ?? Colors.teal, Colors.blueAccent],
              onPressed: onTap,
              child: Text("Submit"),
            ),
          ],
        ),
      ),
    );
  }

  void onTap() {
    print("button click");
  }
}
